// 引入依赖
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
import {createStore, applyMiddleware} from 'redux';
import {Provider} from 'react-redux';
import thunk from 'redux-thunk';

// 引入组件
import Login from './container/login/login';
import Register from './container/register/register';
import AuthRouter from './component/authRouter/authRouter';
import BossInfo from './container/bossInfo/bossInfo';
import GeniusInfo from './container/geniusInfo/geniusInfo';
import Chat from './container/chat/chat';
import Dashboard from './component/dashboard/dashboard';

// 引入文件
import reducer from './redux/reducer';

const store = createStore(reducer,applyMiddleware(thunk));
console.log(store);

ReactDOM.render(
    <Provider store={store}>
        <BrowserRouter>
            <div>
                {/* 进入页面，验证一下用户信息 */}
                <AuthRouter></AuthRouter>
                <Switch>            
                    <Route exact path="/login" component={Login}></Route>
                    <Route path="/register" component={Register}></Route>
                    <Route path="/bossinfo" component={BossInfo}></Route>
                    <Route path="/geniusinfo" component={GeniusInfo}></Route>
                    {/* <Route path="/boss" component={Boss}></Route>
                    <Route path="/genius" component={Genius}></Route> */}
                    <Route path="/dashboard" component={Dashboard}></Route>
                    <Route path="/chat/:user" component={Chat}></Route>
                    <Redirect to="/login"></Redirect>
                </Switch>
            </div>
        </BrowserRouter>
    </Provider>, 
    document.getElementById('root')
);
